package part6blockingque;

import java.util.concurrent.ArrayBlockingQueue;

/**
 * 测试ArrayBlockingQueue的poll方法
 */
public class ArrayBlockingQueueTest02 {

    public static void main(String[] args) {
        ArrayBlockingQueue blockingQueue = new ArrayBlockingQueue<>(3);

        System.out.println(blockingQueue.offer("a"));
        System.out.println(blockingQueue.offer("b"));
        System.out.println(blockingQueue.offer("c"));

        // 检测队列队首元素！
        System.out.println(blockingQueue.peek());

        System.out.println(blockingQueue.poll());
        System.out.println(blockingQueue.poll());
        System.out.println(blockingQueue.poll());
        // null
        System.out.println(blockingQueue.poll());
    }

}
